<!DOCTYPE html>
<html>
    <head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>项目管理- 项目列表</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="shortcut icon" href="../favicon.ico">
	<link href="__PUBLIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link rel="stylesheet" href="__PUBLIC__/css/ace.min.css"/>
	<link href="__PUBLIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	<link href="__PUBLIC__/css/animate.css" rel="stylesheet">
	<link href="__PUBLIC__/css/style.css?v=4.1.0" rel="stylesheet">
	<script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script>
	<style>
	    .table-container {
		overflow: auto;
	    }

	    .img {
		max-width: 64px;
		max-height: 64px;
	    }
	</style>
    </head>
    <body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
	    <div class="row">
		<div class="col-sm-12">
		    <div class="ibox float-e-margins">
			<div class="ibox-title">
			    <h5>项目管理- <small>项目列表</small>
			    </h5>
			    <div class="ibox-tools">
				<!--				<a href="appadd" class="btn btn-primary" style="margin-bottom: 0; margin-top:-8px;">添加</a>-->
			    </div>
			</div>
			<div class="ibox-content">
			    <div class="dataTables_filter">
				<form action="__SELF__" id="form1">
				    <!--				    <div class="btn-group" id="btngroup">
									    <button type="button" id="btnshowlist" name="btnlist" value="1" class="btn <{$btnshowclass.list}> btn-list" onclick="form_btnshow_submit(this)">列表</button>
									    <button type="button" id="btnshowsmall" name="btnsmallpic" value="2" class="btn <{$btnshowclass.small}> btn-small" onclick="form_btnshow_submit(this)">小图</button>
									    <button type="button" id="btnshowbig" name="btnbigpic" value="3" class="btn <{$btnshowclass.big}> btn-big" onclick="form_btnshow_submit(this)">大图</button>
									</div>&nbsp;-->
				    <label>
					<select name="ddlstate" id="ddlstate" onchange="form_submit()">
					    <option value="0">-状态-</option>
					    <volist name="statearr" id="statearr">
						<option value="<{$statearr.value}>" <if condition="$search.statesel eq $statearr['value']">selected</if>><{$statearr.text}></option>
					    </volist>
					</select>
				    </label>
				    <label>
					<input type="text" id="txtbegintime" name="txtbegintime" placeholder="请输入开始时间"
					       readonly="readonly" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm'})"
					       value="<{$search.begintime}>"/>
				    </label>
				    <label>
					<input type="text" id="txtendtime" name="txtendtime" placeholder="请输入结束时间"
					       readonly="readonly" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm'})"
					       value="<{$search.endtime}>"/>
				    </label>
				    <label>
					<input type="text" id="txtkeyword" name="txtkeyword" value="<{$search.keyword}>"
					       placeholder="请输入关键词"/>&nbsp;
					<input type="submit" id="btnsearch" name="btnsearch" value="搜索"/>
				    </label>
				    <input type="hidden" value="<{$show}>" id="hidshow" name="hidshow" />
				</form>
			    </div>
			    <if condition='$show eq "1"'>
				<table class="table table-striped table-bordered table-hover table-container">
				    <thead>
					<tr>
					    <th width="100px;">编号</th>
					    <th>项目图标</th>
					    <th>项目名称</th>
					    <th>项目标识</th>
					    <th width="150px;">状态</th>
					    <th width="150px;">创建时间</th>
					    <th width="200px;" style="text-align: left;">操作</th>
					</tr>
				    </thead>
				    <tbody>
				    <volist name="data" id="vo">
					<tr id="<{$vo.id}>">
					    <td><{$vo.id}></td>
					    <td>
					<if condition="$vo.app_logo neq null && $vo.app_logo neq ''">
					    <img class="img" alt="未找到图片" src="<{$vo.app_logo}>"/>
					</if>
					</td>
					<td><{$vo.app_name}></td>
					<td><{$vo.app_flag}></td>
					<td class="state"><{$vo.app_state_text}></td>
					<td><{$vo.ctime}></td>
					<td class="operate" style="text-align: left;">
					    <!--					    <a class="btn btn-rounded btn-info btn-detail" href="__CONTROLLER__/appenter/code/<{$vo.app_flag}>" title="进入">进入</a>-->
					    <a class="btn btn-rounded btn-info btn-detail" href="__CONTROLLER__/appadd/id/<{$vo.id}>" title="编辑">编辑</a>
					    <a class="btn btn-rounded btn-info btn-detail" href="__CONTROLLER__/index/id/<{$vo.id}>" title="系统设置">系统设置</a>
					    <a class="btn btn-rounded <{$vo.state_class}> btn-state" href="javascript:void(0);" onclick="flag('<{$vo.id}>', '<{$vo.app_state}>')" title="<{$vo.state_lab}>"><{$vo.state_lab}></a>
					    <a class="btn btn-rounded btn-danger btn-delete" href="javascript:void(0);" onclick="del('<{$vo.id}>')" title="删除">删除</a>
					</td>
					</tr>
				    </volist>
				    <if condition="($total eq null) or ($total eq 0)">
					<tr>
					    <td colspan="20">没有数据</td>
					</tr>
				    </if>
				    </tbody>
				</table>
				<else />
				<div class="row">
				    <div class="col-sm-12">
					<volist name="data" id="vo">
					    <div class="file-box">
						<div class="file">
						    <a href="__CONTROLLER__/appadd/id/<{$vo.id}>" title="编辑">
							<span class="corner"></span>
							<div class="image">
							    <img alt="未找到图片" class="img-responsive" src="<{$vo.app_logo}>">
							</div>
							<div class="file-name">
							    <{$vo.app_name}>
							    <br/>
							    <small>创建时间：<{$vo.ctime}></small>
							</div>
						    </a>
						</div>
					    </div>
					</volist>
				    </div>
				</div>
			    </if>
			    <div class="dataTables_paginate paging_simple_numbers">
				<ul class="pagination">
				    <if condition="$total gt 0">
					<{$fpage}>
				    </if>
				</ul>
			    </div>
			</div>
		    </div>
		</div>
	    </div>
	</div>
	<!-- 全局js -->
	<script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
	<script src="__PUBLIC__/js/bootstrap.min.js?v=3.3.6"></script>
	<!-- 自定义js -->
	<script src="__PUBLIC__/js/content.js?v=1.0.0"></script>
	<script src="__PUBLIC__/js/plugins/layer/layer.min.js"></script>
	<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
	<script>
						var $hidshow = $("#hidshow");
						var flagsubmiturl = "<{:U('flagsubmit','','shtml')}>";
						var deletesubmiturl = "<{:U('deletesubmit','','')}>";
						function flag(id, state) {
						    state = state == '1' ? '下架' : '上架';
						    layer.confirm('确定' + state + '该项目吗？', function (index) {
							layer.close(index);
							$.post(flagsubmiturl, {id: id},
								function (data) {
								    if (data.ret == '1001') {
									layer.msg(data.code, {icon: 6, time: 1000});
									$("table tr[id=" + id + "] .state").html(data.data == '1' ? '上架' : '下架');
									$("table tr[id=" + id + "] .operate .btn-state").html(data.data == '1' ? '下架' : '上架').attr("title", data.data == '1' ? '下架' : '上架').attr("onclick", "flag(" + id + "," + data.data + ")").toggleClass("btn-danger").toggleClass("btn-info");
								    } else {
									layer.msg(data.code, {icon: 5, time: 1500});
								    }
								}, 'json');
						    });
						}
						function del(id) {
						    layer.confirm('确定删除该项目吗？', function (index) {
							layer.close(index);
							$.post(deletesubmiturl, {id: id},
								function (data) {
								    if (data.ret == '1001') {
									layer.msg(data.code, {icon: 6, time: 1000});
									setTimeout(function () {
									    window.location.reload();
									}, 1000);
								    } else {
									layer.msg(data.code, {icon: 5, time: 1500});
								    }
								}, 'json');
						    });
						}
						function form_btnshow_submit(obj) {
						    var $obj = $(obj);
						    var val = $obj.val();
						    $hidshow.val(val);
						    form_submit();
						}
						function form_submit() {
						    document.getElementById("form1").submit();
						}
	</script>
    </body>
</html>
